import request from '@/utils/request';

/**
 * 2.6.1 列表查询/coupon-config/activatecode/search
 */
export async function activatecodeSearch(
  data: API.ActivatecodeSearchInfo,
  options?: API.baseOption,
) {
  return request<API.BasePaginationRes<API.ActivatecodeListItem>>('/activatecode/search', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.6.2 激活码明细查询/coupon-config/activatecode/detail
 */
export async function activatecodeDetail(data: { id: string }, options?: API.baseOption) {
  return request<API.ActivatecodeListItem>('/activatecode/detail', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.6.3 修改/coupon-config/activatecode/edit
 */
export async function activatecodeEdit(data: API.ActivatecodeListItem, options?: API.baseOption) {
  return request<string>('/activatecode/edit', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.6.4 代店激活/coupon-config/activatecode/store-activate
 */
export async function storeActivate(data: API.StoreActivateInfo, options?: API.baseOption) {
  return request<string>('/activatecode/store-activate', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.6.5 锁定恢复/coupon-config/activatecode/unlock
 */
export async function unlockActivate(data: { id: number }, options?: API.baseOption) {
  return request<string>('/activatecode/unlock', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}
